<?php
$items =array(
    1=>array('id'=>1 ,'pid'=> 0 ,'name'=>'江西省'),
    2=>array('id'=>2 ,'pid'=> 0 ,'name'=>'黑龙江省'),
    3=>array('id'=>3 ,'pid'=> 1 ,'name'=>'南昌市') ,
    4=>array('id'=>4 ,'pid'=> 2 ,'name'=>'哈尔滨市') ,
    5=>array('id'=>5 ,'pid'=> 2 ,'name'=>'鸡西市') ,
    6=>array('id'=>6 ,'pid'=> 4 ,'name'=>'香坊市') ,
    7=>array('id'=>7 ,'pid'=> 4 ,'name'=>'南岗区') ,
    8=>array('id'=>8 ,'pid'=> 6 ,'name'=>'和兴路') ,
    9=>array('id'=>9 ,'pid'=> 7 ,'name'=>'西大直街') ,
    10=>array('id'=>10 ,'pid'=> 8 ,'name'=>'东北林业大学'),
);

function getTree2($items){
     $array =[];
     foreach ($items as $item){
         if(isset($items[$item['pid']])){
             $items[$item['pid']]['son'][] = &$items[$item['id']];
         }else{
             $array [] = &$items[$item['id']];
         }
     }
     return $array;
}

print_r(getTree2($items));
